<template>
  <el-dialog
    title="编辑"
    :visible.sync="dialogFormVisible"
    width="500px"
    @close="close"
  >
    <!-- <el-card class="card"> -->
    <el-form ref="form" class="form" inline :model="form">
      <el-form-item label="账号状态">
        <el-radio-group v-model="form.account_status">
          <el-radio label="暂停使用" />
          <el-radio label="正常" />
        </el-radio-group>
      </el-form-item>
      <el-form-item label="真实姓名:">
        <el-input v-model="form.truename" placeholder="请输入内容" />
      </el-form-item>
      <el-form-item label="身份证号:">
        <el-input v-model="form.card_id" placeholder="请输入内容" />
      </el-form-item>
      <el-form-item label="实名状态:">
        <el-radio-group v-model="form.card_status">
          <el-radio label="已实名认证" />
          <el-radio label="未实名认证" />
        </el-radio-group>
      </el-form-item>
      <el-form-item label="骑行年龄状态:">
        <el-radio-group v-model="form.is_match_ride_age ? '已通过' : '未通过'">
          <el-radio label="已通过" />
          <el-radio label="未通过" />
        </el-radio-group>
      </el-form-item>
      <el-form-item label="手机号:">
        <el-input v-model="form.mobile" placeholder="请输入内容" />
      </el-form-item>
      <el-form-item label="手机号状态">
        <el-radio-group v-model="form.is_bind_mobile">
          <el-radio label="已绑定" />
          <el-radio label="未绑定" />
        </el-radio-group>
      </el-form-item>
    </el-form>
    <!-- </el-card> -->
    <template #footer>
      <el-button @click="close">取 消</el-button>
      <el-button type="primary" @click="save">确 定</el-button>
    </template>
  </el-dialog>
</template>

<script>
  import { getList } from '@/api/shouye'
  export default {
    data() {
      return {
        form: {
          account_status: '',
          truename: '',
          card_id: '',
          card_status: '',
          is_match_ride_age: '',
          mobile: '',
          is_bind_mobile: '',
        },
        dialogFormVisible: false,
      }
    },
    created() {},
    // 目前不能把数据传给数据库实现真正更改数据
    methods: {
      showEdit(row) {
        // console.log(row, 'row的内容')
        this.form = row
        this.dialogFormVisible = true
      },
      close() {
        this.$refs['form'].resetFields()
        this.form = this.$options.data().form
        this.dialogFormVisible = false
      },
      save() {
        this.$refs['form'].validate(async (valid) => {
          if (valid) {
            const { msg } = await getList(this.form)
            this.$baseMessage(msg, 'success', false, 'vab-hey-message-success')
            this.$emit('fetch-data')
            this.close()
          }
        })
      },
    },
  }
</script>

<style scoped>
  .el-form {
    margin-left: 90px;
  }
</style>
